import Taro, { switchTab, redirectTo } from '@tarojs/taro'
import { View, Image, Button } from '@tarojs/components'
import { AtIcon, AtButton } from 'taro-ui'
import React, { useState } from 'react'

import api from '../../utils/api'
import { useAsyncEffect } from '../../utils/index'

import IconContract from '../../images/icon-contract.png'
import IconDocument from '../../images/icon-document.png'
import IconDownload from '../../images/icon-download.png'

import './auth.less'

function Auth() {
  const handleUserInfo = (e) => {
    Taro.setStorage({
      key: 'userInfo',
      data: e.detail.userInfo
    })
    switchTab({
      url: '/pages/mine/mine'
    })
  }
  return (
    <View className='auth'>
      <View className='layout'>
        <View className='bg'></View>
        <View className='top'></View>
        <View className='group'>
          {/* <Image className='logo'></Image> */}
          <View className='tips'>您还没授权获取用户信息</View>
          <View className='tips'>请先授权获取用户信息</View>
          <AtButton className='btn' circle onGetUserInfo={handleUserInfo} openType='getUserInfo' type='primary'>授权</AtButton>
        </View>
      </View>
    </View>
  )
}

export default Auth
